<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						 <form class="gg-form" role="form" id="modifyPwd">
                            <a id="logout" class="hidden" href="/logout"></a>
                            <input type="hidden" name ="userDO.userId" th:value="${userDO.userId}"/>
                             <div class="gg-formGroup">
                                    <span style="color:red;padding-bottom:10px;" >当前密码已过期，请立即修改密码</span>
                             </div>
                            <div class="gg-formGroup">
                                <div class="gg-formTitle">
                                    <em class="gg-star">*</em>
                                    <span>旧密码:</span>
                                </div>
                                <div class="gg-formDetail gg-dashed">
                                    <input type="password" class="form-control gg-border0" id="pwdOld" name="pwdOld" placeholder="请输入旧密码" />
                                </div>
                            </div>
                            <div class="gg-formGroup">
                                <div class="gg-formTitle">
                                    <em class="gg-star">*</em>
                                    <span>新密码:</span>
                                </div>
                                <div class="gg-formDetail gg-dashed">
                                    <input type="password" class="form-control gg-border0" id="pwdNew" name="pwdNew" placeholder="请输入新密码" />
                                </div>
                            </div>
                            <div class="gg-formGroup">
                                <div class="gg-formTitle">
                                    <em class="gg-star">*</em>
                                    <span>确认密码:</span>
                                </div>
                                <div class="gg-formDetail gg-dashed">
                                    <input type="password" class="form-control gg-border0" id="confirm_password" name="confirm_password" placeholder="请确认密码" />
                                </div>
                            </div>
                        </form>
                        <div class="gg-btnGroup">
                            <button type="button" class="btn btn-sm btn-primary" id="pwd_save">保存</button>
                        </div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div th:include="system/user/include :: footer"></div>
	<script th:inline="javascript"> var ctx = [[@{/}]] ; </script>
	<script src="/js/plugins/layer/layer.min.js"
		th:src="@{/js/plugins/layer/layer.min.js}"></script>
	<script>
	$("#pwd_save").click(function () {
	    if($("#modifyPwd").valid()){
	        $.ajax({
	            cache : true,
	            type : "POST",
	            url : ctx + "changePwd",
	            data : $('#modifyPwd').serialize(),
	            async : false,
	            error : function(request) {
	            	layer.msg("Connection error");
	            },
	            success : function(data) {
	                if (data.code == 0) {
	                	layer.msg('更新密码成功');
	                    location.href = ctx + 'login';
	                } else {
	                	layer.msg(data.msg)
	                }
	            }
	        });
	    }
	});
</script>
</body>
</html>